CREATE TABLE DatabaseVersion (
	CurrentVersion INT
)
GO

INSERT INTO DatabaseVersion(CurrentVersion) VALUES(19)
GO

--
-- Project
--
CREATE TABLE [Project](
	[ProjectName] [varchar](20) NOT NULL,
	[Title] [varchar](80) NOT NULL,
	[Description] [text] NOT NULL,
	[LicenseName] [varchar](50) NOT NULL,
	[LicenseText] [text] NOT NULL,
	TeamFoundationProjectCreated BIT NOT NULL,
	TeamFoundationServerName VARCHAR(250),
	TeamFoundationProjectUri VARCHAR(250),
	TeamFoundationProjectId INT,
	FileReleaseEnabled BIT NOT NULL,
	DiscussionsEnabled BIT NOT NULL,
	WorkItemTrackingEnabled BIT NOT NULL,
	SourceCodeBrowsingEnabled BIT NOT NULL,
	NewsFeedsEnabled BIT NOT NULL,
	CreatedDate DATETIME NOT NULL
)
GO

ALTER TABLE Project
ADD CONSTRAINT PK_Project PRIMARY KEY (ProjectName)
GO

--Control-of-Flow Language http://msdn.microsoft.com/en-us/library/ms174290.aspx
WHILE (@@FETCH_STATUS <> -1)
BEGIN
   IF (@@FETCH_STATUS <> -2)
   BEGIN   
      SELECT @tablename = RTRIM(@tablename); 
      EXEC ('SELECT ''' + @tablename + ''' = count(*) FROM ' 
            + @tablename );
      PRINT ' ';
   END;
   FETCH NEXT FROM tnames_cursor INTO @tablename;
END;

